from django.contrib import admin
from .models import Post, Category, Tag
# Register your models here.

# myuser
# 123456


class PostAdmin(admin.ModelAdmin):
    list_display = ['title', 'created_time', 'modified_time', 'category', 'author']   # 在admin后台的一些展示形式
    fields = ['title', 'body', 'excerpt', 'category', 'tags']  # 在填写表单时展示的形式

    def save_model(self, request, obj, form, change):
        obj.author = request.user
        super().save_model(request, obj, form, change)



admin.site.register(Post, PostAdmin) # 把新增的PostAdmin也加进来
admin.site.register(Category)
admin.site.register(Tag)


